/** 
* All Rights Reserved , Copyright (C) 2020 , 青岛鼎信通讯股份有限公司
* 
* MeetAgendaService
* 会议议程
* 
* 修改纪录
* 2020-10-24 版本：1.0 donghang 创建。
* @version 版本：1.0
* @author 作者：donghang
* 创建日期：2020-10-24
*/
package com.topscomm.meet.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import com.topscomm.meet.pojo.MeetAgendaEntity;
import com.topscomm.meet.service.IMeetAgendaService;
import com.topscomm.meet.service.impl.auto.MeetAgendaServiceAuto;
import com.topscomm.pub.util.ConvertUtil;
import com.topscomm.pub.util.StringBufferProxy;
import com.topscomm.tap.common.DatacodeCache;

@Service(value = "meetAgendaService")
@Scope(value = "singleton")
public class MeetAgendaService extends MeetAgendaServiceAuto implements IMeetAgendaService {
	/**
	 * 插入会议议程，包括增加、修改操作
	 * 
	 * @description:
	 * @param agendaList
	 * @author: donghang
	 * @date: 2020年10月26日上午10:19:38
	 * @modify:
	 */
	@Override
	public void insertMeetAgendaList(List<Map<String, Object>> agendaList) {
		for (Map<String, Object> agenda : agendaList) {
			MeetAgendaEntity meetAgendaEntity = new MeetAgendaEntity();
			meetAgendaEntity.convertFromMap(agenda);
			if (meetAgendaEntity.getId() > 0) {
				this.update(agenda);
			} else {
				this.insert(meetAgendaEntity);
			}
		}
	}

	/**
	 * @description: 删除会议日程信息
	 * @param meetIdList
	 * @author: wanghongwei
	 * @date: 2020-11-2 10:31:20
	 * @modify:
	 */
	@Override
	public void deleteBySource(List<String> meetIdList) {
		if (meetIdList == null || meetIdList.size() <= 0) {
			return;
		}
		for (String meetId : meetIdList) {
			StringBufferProxy sql = new StringBufferProxy();
			sql.appendSingle(" meetid = '{0}' ", meetId);
			List<MeetAgendaEntity> meetAgendaEntityList = this.queryByWhere(sql.toString());
			// 遍历删除
			for (MeetAgendaEntity entity : meetAgendaEntityList) {
				this.deleteById(ConvertUtil.convertToString(entity.getId()));
			}
		}
	}

	/**
	 * 特殊处理值
	 * 
	 * @description:
	 * @param mapRow
	 * @param datacodeCache
	 * @author: donghang
	 * @date: 2020年12月6日上午11:17:13
	 * @modify:
	 */
	@Override
	public void setDispFields(Map<String, Object> mapRow, DatacodeCache datacodeCache) {
		if (mapRow.get("reportminutes") != null) {
			if (ConvertUtil.convertToInt(mapRow.get("reportminutes").toString()) == 0) {
				mapRow.put("reportminutes", "");
			}
		}

	}
}
